package rush.edu.wechat.common.utils;

import org.springframework.security.crypto.bcrypt.BCrypt;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * 
 * @Description 加密操作
 * @author 梅景飞
 * @date 2016年12月6日 下午1:33:56 
 * @version V0.1
 */
public class BCryptEncoder {

	public static String Encoder(String sString){
		BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
	    String hashedPassword = passwordEncoder.encode(sString);
		return hashedPassword;
	}
	
	public static boolean checkPsw(String plaintext,String hashed){
		return BCrypt.checkpw(plaintext, hashed);
	}
}
